﻿@model IEnumerable<Pr0ject0.Models.QuestionModel>

@{
    Dictionary<string, int> types = new Dictionary<string, int>();
    foreach(KeyValuePair<string, int> kv in (IEnumerable<KeyValuePair<string, int>>)ViewData["types"])
    {
        types.Add(kv.Key, kv.Value);
    }
    
}
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.question)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.type)
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.question)
        </td>
        <td>
            @types.First(x => x.Value == item.type).Key
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.id })
        </td>
    </tr>
}

</table>
